package antcraft;

import java.io.*;

public class PheromoneMapTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		PheromoneMap testMap = new PheromoneMap( 6, 6 );
	
		System.out.println( "Map initialized to:" );
		printMap( 0, testMap );
		
		System.out.println();
		System.out.println( "Adding 1.0 at PI to 3,3,0, and 1.0 at 1.5PI to 1,2,1" );
		testMap.placePheromone( 3, 3, 0, 1.0, Math.PI );
		testMap.placePheromone( 1, 2, 1, 1.0, 1.5 * Math.PI );
		printMap( 0, testMap );
		
		System.out.println();
		System.out.println( "Diffusing" );
		for( int i = 0; i < 3; i++ ) testMap.diffuse( 0, 1 );
		for( int i = 0; i < 3; i++ ) testMap.diffuse( 1, 1 );
		System.out.println( "0" );
		printMap( 0, testMap );
		System.out.println( "1" );
		printMap( 1, testMap );
	}
	
	public static void printMap( int type, PheromoneMap map ) {
		PrintStream ps = new PrintStream( System.out );
		for( int i = 0; i < map.m_mapWidth; i++ ) {
			for( int j = 0; j < map.m_mapHeight; j++ )
				ps.printf( "%1.4f@%1.4f  ", map.getMagnitude( i, j, type ),
						map.getDirection( i, j, type ) );
			ps.println();
		}
	}

}
